<template>
	<view>
		<view class="topview">
		<!-- 	<u-search searchIconSize="35" :showAction="true" placeholder="请输入营运车辆信息" actionText="搜索" :animation="true">
			</u-search> -->
			<u-tabs :list="list1" @click="tabClick" :current="current" @change="tabChange" lineWidth="63px"
				lineColor="#1590EF" :activeStyle="{
					    color: '#1590EF',
					    fontWeight: 'bold',
					    transform: 'scale(1.05)'
					}" :inactiveStyle="{
					    color: '#606266',
					    transform: 'scale(1)'
					}" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"></u-tabs>
		</view>



		<!-- 从业人员信息 -->
		<view style="padding-bottom: 20px;" v-if="current==0">
			<!-- 基本信息 -->
			<view class="list_item">
				<view class="item_top">
					<view class="view_pai">
						<u-image :src="src1" width="10px" height="12px" style="margin-right: 5px;"></u-image>
						<text class="text_pai">基本信息</text>
					</view>
				</view>
				<view style="height: 1px;background-color: #ccc;"></view>
				<view class="item_bottom">
					<view class="bottom_text">
						<view class="text_left">车辆号牌</view>
						<view class="text_right">{{mapData.vehCode}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">车牌颜色</view>
						<view class="text_right">{{mapData.vehColor}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">营运状态</view>
						<view class="text_right">{{findState(mapData.ccertState)}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">所属企业</view>
						<view class="text_right">{{mapData.ownerName}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">VIN码</view>
						<view class="text_right">{{mapData.vinCode}}</view>
					</view>

					<view class="bottom_text">
						<view class="text_left">车辆类型</view>
						<view class="text_right">{{mapData.vehType}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">吨位</view>
						<view class="text_right">{{mapData.tonnage}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">燃料类型</view>
						<view class="text_right">{{mapData.fuelType}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">车辆高度</view>
						<view class="text_right">{{mapData.vehHigh}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">车辆长度</view>
						<view class="text_right">{{mapData.vehLength}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">车籍地</view>
						<view class="text_right">{{mapData.vehRegistry}}</view>
					</view>

				</view>
			</view>

			<!-- 从业资格证信息 -->
			<view class="list_item">
				<view class="item_top">
					<view class="view_pai">
						<u-image :src="src1" width="10px" height="12px" style="margin-right: 5px;"></u-image>
						<text class="text_pai">道路运输证信息</text>
					</view>
				</view>
				<view style="height: 1px;background-color: #ccc;"></view>
				<view class="item_bottom">
					<view class="bottom_text">
						<view class="text_left">道路运输证号</view>
						<view class="text_right">{{mapData.ccertId}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">发证机关</view>
						<view class="text_right">{{mapData.grantDepartment}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">有效期起</view>
						<view class="text_right">{{mapData.firstDate}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">有效期止</view>
						<view class="text_right">{{mapData.expireDate}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">经营范围</view>
						<view class="text_right">{{mapData.mgrArea}}</view>
					</view>
				</view>
			</view>


			<!-- 诚信考核信息 -->
			<view class="list_item">
				<view class="item_top">
					<view class="view_pai">
						<u-image :src="src1" width="10px" height="12px" style="margin-right: 5px;"></u-image>
						<text class="text_pai">车辆审验信息</text>
					</view>
				</view>
				<view style="height: 1px;background-color: #ccc;"></view>
				<view class="item_bottom">
					<view class="bottom_text">
						<view class="text_left">评定等级</view>
						<view class="text_right">{{mapData.vehTecRank}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">评定时间</view>
						<view class="text_right">{{mapData.vehRankDate}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">评定机构</view>
						<view class="text_right">{{mapData.vehTecRankOrg}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">次技术等级评定日期</view>
						<view class="text_right">{{mapData.nextVehRankDate}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">下次年审日期</view>
						<view class="text_right">{{mapData.nextCheckDate}}</view>
					</view>

					<view class="bottom_text">
						<view class="text_left">罐体检测有效期</view>
						<view class="text_right">{{mapData.tankValidDate}}</view>
					</view>

				</view>
			</view>



		</view>

		<!-- 从业人员违规信息 -->
		<view style="padding-bottom: 20px;" v-if="current==1">
			<!-- 基本信息 -->
			<view class="list_item">
				<view class="item_top">
					<view class="view_pai">
						<u-image :src="src1" width="10px" height="12px" style="margin-right: 5px;"></u-image>
						<text class="text_pai">基本信息</text>
					</view>
				</view>
				<view style="height: 1px;background-color: #ccc;"></view>
				<view class="item_bottom">
					<view class="bottom_text">
						<view class="text_left">车辆号牌</view>
						<view class="text_right">{{mapData.vehCode}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">车牌颜色</view>
						<view class="text_right">{{mapData.vehColor}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">车籍地</view>
						<view class="text_right">{{mapData.vehRegistry}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">VIN码</view>
						<view class="text_right">{{mapData.vinCode}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">营运状态</view>
						<view class="text_right">{{findState(mapData.ccertState)}}</view>
					</view>
				</view>
			</view>


			<view class="list_item" v-for="(item,index) in listData" :key="index">
				<view class="item_top">
					<view class="view_pai">
						<u-image :src="src1" width="10px" height="12px" style="margin-right: 5px;"></u-image>
						<text class="text_pai">案件号&nbsp;{{item.caseNo}}</text>
					</view>
				</view>
				<view style="height: 1px;background-color: #ccc;"></view>
				<view class="item_bottom">
					<view class="bottom_text">
						<view class="text_left">违规类型</view>
						<view class="text_right">{{item.trafficType}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">发生时间</view>
						<view class="text_right">{{item.trafficTime}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">违规行为</view>
						<view class="text_right">{{item.trafficEhavior}}</view>
					</view>
					<view class="bottom_text">
						<view class="text_left">结案时间</view>
						<view class="text_right">{{item.jasj}}</view>
					</view>
				</view>
			</view>

		</view>






	</view>
</template>

<script>
	import {
		maCode,
		getDetail
	} from '@/common/api/req.js'
	export default {
		data() {
			return {
				src1: "/static/index/tj_icon.png",
				list1: [{
					name: '车辆信息',
				}, {
					name: '车辆违章信息',
				}],
				current: 0,
				// mapData: {
				// 	gender: '男',
				// 	data: '2022-02-55',
				// 	idcard: '125456545654565454',
				// 	ownername: '中交信捷公司'
				// },
				mapData: {},
				listData: [],
				array: []


			};
		},
		onLoad(option) {

			this.mapData = JSON.parse(option.data)
			this.listData = JSON.parse(option.data).violationVOList
		},
		mounted() {
			this.getMaCode()
			getDetail('veh_tech_rank').then(res => {
				res.data.data.map(item => {
					if (item.dictKey == this.mapData.vehTecRank) {
						this.mapData.vehTecRank = item.dictValue
					}
				})
			
			})
		},
		methods: {
			findState(state) {
				let data= this.array.find((item) => {
					return item.dictKey == state
				})
				if(data){
					 return data.dictValue
				}
				return state;// 外省返回的是中文，字典里面查不到
				console.log(data, '++++++++');
			},
			getMaCode() {
				//营运状态
				maCode('ccert_state').then(res => {
					// console.log(res, '/*******//');
					let list = res.data.data
					this.array = list.map(item => {
						return {
							dictValue: item.dictValue,
							dictKey: item.dictKey
						}
					})

				})
			},
			tabClick() {},
			tabChange(e) {
				console.log("----", e);
				this.current = e.index
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #EFEFEF;
	}

	.topview {
		padding: 0px 15px;
		background-color: #fff;
		position: sticky;
		top: 0;
		z-index: 999;

		.u-search__content {
			padding: 5px 10px;
		}
	}




	.list_item {
		border-radius: 10px;
		background-color: #FFFFFF;
		margin: 10px 20px 0 20px;
		padding-bottom: 5px;



		.item_top {
			display: flex;
			justify-content: space-between;
			height: 80rpx;
			border-radius: 10rpx;

			.view_pai {
				padding-left: 30rpx;
				height: 40rpx;
				margin-top: 30rpx;
				display: flex;
				align-items: center;

				.text_pai {
					font-size: 28rpx;
					font-weight: 700;
				}
			}

			.view_state {
				height: 50rpx;
				border-top-right-radius: 10rpx;
				border-bottom-left-radius: 8rpx;
				padding-left: 5rpx;
				padding-right: 5rpx;
				background-color: #666666;
				display: flex;
				align-items: center;

				.text_state {
					font-size: 28rpx;
					font-weight: 700;
				}
			}

		}

		.item_line {
			height: 1rpx;
			background-color: #F2F2F2;
			margin-left: 35rpx;
			margin-right: 35rpx;
		}

		.item_center {
			display: flex;
			flex-direction: column;
			padding-left: 35rpx;
			padding-top: 20rpx;
			padding-bottom: 10rpx;

			.center_top {
				display: flex;
				height: 50rpx;
				align-items: center;

				.view_jia {
					width: 45rpx;
					height: 45rpx;
					background-color: #4CAF50;
					border-radius: 45rpx;
					display: flex;
					justify-content: center;
					align-items: center;

					text {
						color: #FFFFFF;
						font-size: 20rpx;
						font-weight: 700;
					}
				}

				.view_ya {
					width: 45rpx;
					height: 45rpx;
					background-color: #2196F3;
					border-radius: 45rpx;
					display: flex;
					justify-content: center;
					align-items: center;

					text {
						color: #FFFFFF;
						font-size: 20rpx;
						font-weight: 700;
					}
				}

				.text_name {
					margin-left: 20rpx;
					font-size: 28rpx;
					font-weight: 700;
				}

				.text_phone {
					margin-left: 30rpx;
					font-size: 28rpx;
					font-weight: 700;
					color: #666666;
				}
			}

			.center_line {
				margin-left: 22rpx;
				height: 15rpx;
				width: 5rpx;
				background-color: #000000;
			}

		}

		.item_bottom {
			display: flex;
			flex-direction: column;
			padding-left: 35rpx;
			padding-top: 10px;

			.bottom_text {
				display: flex;
				align-items: center;
				padding-top: 10rpx;
				padding-bottom: 10rpx;

				.text_left {
					font-size: 30rpx;
					color: #666666;
					width: 120px;
				}

				.text_right {
					flex: 1;
					font-size: 30rpx;
					display: inline-block;
					// white-space: nowrap;
					// overflow: hidden;
					// text-overflow: ellipsis;
				}

			}
		}
	}


	.view_name {
		// width: calc(100% - 40px);
		height: 90px;
		display: flex;
		padding: 10px;
		background-color: #fff;
		margin: 10px 20px;
		border-radius: 10px;

		.left_name {
			flex: 2;
			background-color: aqua;
			display: flex;
			align-items: center;

			text {
				color: #1590EF;
				font-size: 20px;
				margin-left: 15px;
			}
		}

		.right_code {
			flex: 1;
			background-color: aquamarine;
		}

	}
</style>
